package cz.semjobKB.conllx.api.impl;

import cz.semjobKB.conllx.node.EConstituent;
import cz.semjobKB.conllx.node.EWordType;
import cz.semjobKB.conllx.node.ILinguisticWord;
import cz.semjobKB.conllx.api.ISentence;
import cz.semjobKB.conllx.api.IWord;
/**
 * Stores information about particular word of a sentence
 * 
 * @author Synergy
 */
public class Word implements IWord {

	private static final long serialVersionUID = -6354281651789304127L;

	private final ILinguisticWord linguisticWord;

	private Sentence sentence = null;

	private IWord nextWord = null;

	private IWord previousWord = null;

	/**
	 * Instantiate new Word class.
	 * 
	 * @param word linguistic word
	 * @param sentence in which the word belongs
	 */
	public Word(final ILinguisticWord word, final Sentence sentence) {		
		this.linguisticWord = word;
		this.sentence = sentence;		

	}

	public String getText() {
		return this.linguisticWord.getText();
	}

	public String getLemma() {
		return this.linguisticWord.getLemma();
	}

	public IWord getNextWord() {
		return nextWord;
	}

	public ISentence getSentence() {
		return sentence;
	}

	public IWord getPreviousWord() {
		return previousWord;
	}

	public void setPreviousWord(final IWord previousWord) {
		this.previousWord = (Word) previousWord;
	}

	public void setNextWord(final IWord nextWord) {
		this.nextWord = nextWord;
	}

    public ILinguisticWord getLinguisticWord() {
        return linguisticWord;
    }
    @Override
	public String toString() {
		return this.linguisticWord.getText();
	}

	public EConstituent getConstituent() {
		return linguisticWord.getConstituent();
	}

	public short getParentNode() {
		return linguisticWord.getParentNode();
	}

	public boolean isLeftValence() {
		if (sentence.getWords().indexOf(this) < getParentNode()) {
			return true;
		}
		return false;
	}

	public EWordType getWordType() {
		return linguisticWord.getWordType();
	}


	public char getGenus() {
		return linguisticWord.getGenus();
	}


	public char getNumber() {
		return linguisticWord.getNumber();
	}


	public char getFall() {
		return linguisticWord.getFall();
	}


	public char getPerson() {
		return linguisticWord.getPerson();
	}


	public void setText(String text) {
		this.linguisticWord.setText(text);
	}
}
